package org.pentaho.cubic.client.perspective.demo;

import org.pentaho.cubic.client.service.CubicServiceCache;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;

public class ObjectOne extends Composite {

	private static ObjectOneUiBinder uiBinder = GWT
			.create(ObjectOneUiBinder.class);

	interface ObjectOneUiBinder extends UiBinder<Widget, ObjectOne> {
	}

	public ObjectOne() {
		initWidget(uiBinder.createAndBindUi(this));
		performOperation();
	}

	@UiField HTML html;


	protected void performOperation() {
		AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
			public void onFailure(Throwable caught) {
				html.setHTML("Error " + caught.getMessage());
			}

			public void onSuccess(Boolean version) {
				html.setHTML("Welcome to Pentaho BI " + version);
			}
		};
		CubicServiceCache.getService().isAdministrator(callback);
	}
	  
}
